package mamma.dao;

import java.util.List;

import mamma.common.MybatisConfig;
import mamma.vo.MemberVo;
import mamma.vo.PhotoVo;
import mamma.vo.SearchVo;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class AccountDao {
	private SqlSessionFactory factory;
	
	public AccountDao(){
		factory = MybatisConfig.getSqlSessionFactory();
	}
	
	// select the user's photos
	public List<PhotoVo> selectPhoto(PhotoVo vo){
		SqlSession session = factory.openSession();
		System.out.println(vo);
		List<PhotoVo> list = session.selectList("account.selectPhoto", vo);
		session.close();
		
		return list;
	}
	
	// search the member
	public List<SearchVo> searchMember(String keyword){
		SqlSession session = factory.openSession();
		List<SearchVo> list = session.selectList("friends.searchMember", keyword);
		session.close();
		
		return list;
	}
}
